package inventory.daoImplementer;

import dbhandelling.Crude;
import dto.Stock;
import inventory.daoInterface.MaterialMasterDao;
import inventory.daoInterface.StockInDao;


public class StockInImplementor extends Crude implements StockInDao
{
	
	@Override
	public void add(Stock materialMaster) throws Exception 
	{
		insert(materialMaster);
	}

	@Override
	public void update(Stock materialMaster) throws Exception 
	{
		
	}

	@Override
	public void delete(Stock materialMaster) throws Exception 
	{
		
	}

	@Override
	public Stock retreive(String conditionField, String ConditionValue) throws Exception 
	{
		Stock materialMaster=(Stock) super.retreive("Stock",conditionField, ConditionValue);
		return materialMaster;
	}

	@Override
	public Stock[] retreiveArray(String conditionField, String conditionValue) throws Exception 
	{
		Stock[] materialMasters;
		Object[] obj=super.retreiveArrayOnCondition("Stock", conditionField, conditionValue);
		materialMasters=new Stock[obj.length];
		
		for(int i=0;i<materialMasters.length;i++)
		{
			materialMasters[i]=(Stock) obj[i];
		}
		
		return materialMasters;
	}

	@Override
	public Stock[] retreiveAll() throws Exception 
	{
		Stock[] materialMasters;
		
		Object[] obj=super.retreiveAll("Stock");
		
		materialMasters=new Stock[obj.length];
		
		for(int i=0;i<materialMasters.length;i++)
		{
			materialMasters[i]=(Stock) obj[i];
		}
		
		return materialMasters;
	}

}
